package com.oa.xinxi.biz;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.oa.xinxi.dao.HuiYiJiYaoMapper;
import com.oa.xinxi.dao.NewsMapper;
import com.oa.xinxi.entity.HuiYiJiYao;
import com.oa.xinxi.entity.News;

@Service
public class HYJYBiz {
	@Resource
	private HuiYiJiYaoMapper mapper;
	public void save(HuiYiJiYao hyjy) {
		hyjy.setCreatetime(new Date());
		mapper.insert(hyjy);
	}
	public void deleteById(int id) {
		mapper.deleteByPrimaryKey(id);
	}
	public void update(HuiYiJiYao hyjy) {
		hyjy.setUpdatetime(new Date());
		HuiYiJiYao hyjy2 = mapper.selectByPrimaryKey(hyjy.getJiyaoId());
		hyjy.setCreatetime(hyjy2.getCreatetime());
		hyjy.setCreator(hyjy2.getCreator());
		mapper.updateByPrimaryKeySelective(hyjy);
	}
	public HuiYiJiYao findById(Integer id) {
		return mapper.selectByPrimaryKey(id);
	}
	public List<HuiYiJiYao> findAll() {
		return mapper.findAll();
	}
}
